(function(factory){
    var root =this,Baitai = root.Baitai = root.Baitai ? root.Baitai : {};
    Baitai.Dialog = factory(root);
    if (typeof module !== "undefined" && module.exports) {
        module.exports = Baitai.Dialog;
    }
}(function(root){
    var tpl = _include('./index.html');
    function Dialog(options){
        this.options = options;
        this._showCover();
        this._show();
        this._bindEvent();
    }

    Dialog.prototype._bindEvent=function(){
        this._el.querySelector('button').addEventListener('click',function(){
            this._el.parentNode.removeChild(this._el);
        }.bind(this))
    },

    Dialog.prototype._showCover=function(){
        if(this.options.cover){
            tpl = '<div class="m-dialog-cover">'+tpl+'</div>';
        }
    };

    Dialog.prototype._show = function(){
        var el = document.createElement('div');
        el.innerHTML = tpl;
        el.querySelector('.body').innerHTML = this.options.body;
        el = el.querySelector('div');
        document.body.appendChild(el);
        this._el = el;
    };


    return Dialog;
}));